

var id = getQuery("id")

window.onload = function (){
    findById(id);
}

function findById(id){
    axios.get("/manager/order/findById",{
        params: {
            id
        }
    }).then(e=>{
        var info = e.data;
        $("id").innerHTML =info.id;
        $("accept").innerHTML =info.accept;
        $("address").innerHTML =info.address;
        $("phone").innerHTML =info.phone;
        $("date").innerHTML =info.date;
        $("price").innerHTML =info.price;
        $("status").innerHTML =info.status;

        var str ="";
        for (var i=0;i<info.infoList.length;i++){
            var obj = info.infoList[i];
            str+=`<tr><td>${obj.product.id}</td><td>${obj.product.name}</td><td>
                ${obj.product.price}</td><td>${obj.num}</td></tr>`
        }
        $("ODiv").innerHTML =str;
    })
}


function returnO(){
    location.href="/manager/orderManager.html";
}


function updateStatus(){
    axios.get("/manager/order/updateStatus",{
        params:{
            id:id,
            status:"发货中"
        }
    }).then(e=>{
        if (e.data =="ok"){
            location.href="/manager/orderManager.html";
        }
    })
}
